<?php
$this->lang->load('template');
?>
<script type="text/javascript" charset="utf-8" src="<?=base_url('js/ueditor/ueditor.config.js')?>"></script>
<script type="text/javascript" charset="utf-8" src="<?=base_url('js/ueditor/ueditor.all.js')?>"> </script>
<script type="text/javascript" charset="utf-8" src="<?=base_url('js/ueditor/lang/zh-cn/zh-cn.js')?>"></script>
		<script type="text/javascript">
        	var ue = UE.getEditor('editor', {
        		autoHeight: false
            });
        </script>
<form action="" class="edit_product" enctype="multipart/form-data" method="post">
  <input type="hidden" name="redirect" value="<?=getUrl(false);?>" />
  <input type="hidden" name="articles[id]" value="<?=isset($articles['id'])?$articles['id']:''?>" />
  <input type="hidden" name="articles[type]" value="article" />
  <div class="yui-gc">
    <div class="yui-u first">
      <p>
        <label for="product_name">文章名称</label>
        <span class="required">*</span><br />
        <input class="fullwidth title" id="product_name" name="articles[title]" size="30" type="text" value="<?=isset($articles['title'])?$articles['title']:''?>" />
      </p>
      <p>
        <label for="product_price">文章所属分类/类型</label>
        <span class="required">*</span><br />
        <select id="product_category_id" name="articles[category_id]">
          <option value="0">请选择文章所属分类</option>
          <?php
          foreach($categories as $item):
		  ?>
          <option value="<?=$item['id']?>"<?php if(isset($articles['category_id'])&&$articles['category_id']==$item['id']):?> selected="selected"<?php endif;?>>
          <?=str_repeat('&nbsp;&nbsp;&nbsp;',$item['level']).$item['name']?>
          </option>
          <?php endforeach;?>
        </select>
      </p>
      <p>
        <label for="product_summary">文章概要</label>
        <br />
        <textarea class="fullwidth" style="height: 50px;" cols="80" name="articles[summary]" rows="4"><?=isset($articles['summary'])?$articles['summary']:''?>
</textarea>
      </p>
      <p>
        <label for="product_description">文章描述</label>
        <br />
        <textarea class="fullwidth" cols="80" id="editor" name="articles[content]" rows="4"><?=isset($articles['content'])?$articles['content']:''?>
</textarea>
      </p>
      <!-- 
      <p>
        <label for="product_meta_keywords">Meta关键字</label>
        <br />
        <input class="fullwidth" id="product_meta_keywords" name="articles[meta_keyword]" value="<?=$articles['meta_keyword']?>" size="30" type="text" />
      </p>
      <p>
        <label for="product_meta_description">Meta描述</label>
        <br />
        <input class="fullwidth" id="product_meta_description" name="articles[meta_description]" value="<?=$articles['meta_description']?>" size="30" type="text" />
      </p>
       -->
    </div>
    <div class="yui-u">
      <p>
        <label for="product_hall">上传文章封面</label>
        <br />
        <input id="logo" name="logo" size="20" type="file" />
        <?php if( !empty($articles['logo']) ):?>
        <br />
        你已经上传过图片。再次上传时将覆盖原图片！
        <?php endif;?>
      </p>
      <p>
        <label for="product_price">是否显示</label>
        <br />
        <input type="radio" name="articles[is_show]" value="1" <?php if( isset($articles['is_show']) && $articles['is_show']==1):?> checked="checked"<?php endif;?> />
        是
        <input type="radio" name="articles[is_show]" value="0" <?php if( empty($articles['is_show']) ):?> checked="checked"<?php endif;?>  />
        否 </p>
      <p>
        <label for="product_price">是否推荐文章</label>
        <br />
        <input type="radio" name="articles[is_recommend]" value="1" <?php if( isset($articles['is_recommend']) && $articles['is_recommend']==1):?> checked="checked"<?php endif;?> />
        是
        <input type="radio" name="articles[is_recommend]" value="0"<?php if (empty($articles['is_recommend'])):?> checked="checked"<?php endif;?>  />
        否 </p>
      <p>
        <label for="product_price">是否置顶文章</label>
        <br />
        <input type="radio" name="articles[is_top]" value="1" <?php if( isset($articles['is_top']) && $articles['is_top']==1):?> checked="checked"<?php endif;?> />
        是
        <input type="radio" name="articles[is_top]" value="0" <?php if( empty($articles['is_top'])):?> checked="checked"<?php endif;?>  />
        否 </p>
      <p>
        <label for="product_price">是否热门文章</label>
        <br />
        <input type="radio" name="articles[is_hot]" value="1" <?php if( isset($articles['is_hot']) && $articles['is_hot']==1):?> checked="checked"<?php endif;?> />
        是
        <input type="radio" name="articles[is_hot]" value="0" <?php if( empty($articles['is_hot'])):?> checked="checked"<?php endif;?>  />
        否 </p>
      <p>
        <label for="product_price">是否最新文章</label>
        <br />
        <input type="radio" name="articles[is_new]" value="1" <?php if( isset($articles['is_new']) && $articles['is_new']==1):?> checked="checked"<?php endif;?> />
        是
        <input type="radio" name="articles[is_new]" value="0" <?php if( empty($articles['is_new'])):?> checked="checked"<?php endif;?>  />
        否 </p>
    </div>
  </div>
  <p class="form-buttons">
  	<button type="submit"><span><?=$this->lang->line('tpl_submit')?></span></button>
    <a href="<?=getUrl(false);?>"><?=$this->lang->line('tpl_cancel')?></a>
  </p>
</form>